<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateOpenShopOrderTags extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('open_shop_order_tags_mapping', function (Blueprint $table) {
            $table->id();
            $table->string('orderNo', 60)->default('')->comment('订单号');
            $table->unsignedBigInteger('tagId')->default(0)->comment('标签Id');
            $table->string('desc')->default('')->comment('标签描述');
            $table->string('remark')->default('')->comment('标签原因');
//            $table->unsignedTinyInteger('type')->default(0)
//                  ->comment('标签类型 0 通用标签 全流程展示 1解约标签 2 设备支付标签 3 软装支付标签 4 商学院培训标签');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->unsignedTinyInteger('isDeleted')->default(0)->comment('删除');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '开店订单tag关联表';

            $table->index('orderNo', 'idx_orderNo');
            $table->index('tagId', 'idx_tagId');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('open_shop_order_tags_mapping');
    }
}
